{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>添加启动广告</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">上传类型(如果上传视频不要超过1分钟)：</label>
                <div class="layui-input-block">
                    <select name="b_type" class="b_type" lay-filter="aaaa">
                        <option value="1" >图片</option>
                        <option value="2" >视频</option>
                        <option value="3" >音频</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">上传文件：</label>
                <input type="hidden" name="img_file" id="lay-file" lay-verify="image">
                <div class="layui-input-block">
                    <div id="lay-upload">上传文件</div>
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                        状态信息：
                        <div class="layui-upload-list" id="lay-list">
                        </div>
                    </blockquote>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8 bbbb" style="display:none">
                <label class="layui-form-label">上传缩略图：</label>
                <input type="hidden" name="lay-img" id="lay-file1">
                <div class="layui-input-block">
                    <div id="lay-upload1">上传文件</div>
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                        状态信息：
                        <div class="layui-upload-list" id="lay-list1">
                        </div>
                    </blockquote>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">广告名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="b_name" lay-verify="required" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">是否设置发送时间：</label>
                <div class="layui-input-block">
                    <select name="publish" class="publish" lay-filter="aaaaa">
                        <option value="1" >是</option>
                        <option value="2" >否</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8 bbbbb">
                <label class="layui-form-label">发送时间：</label>
                <div class="layui-input-block">
                    <input type="text"  name="start" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="开始日期" />
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                    <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('select(aaaa)', function(data){
            if(data.value==3){
                $(".bbbb").show();
            }else{
                $(".bbbb").hide();
            }
        });
        form.on('select(aaaaa)', function(data){
            if(data.value==1){
                $(".bbbbb").show();
            }else{
                $(".bbbbb").hide();
            }
        });
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('add')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('startover/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
                    }
                }
            })
        });
    });
</script>
<script>
    wk.uploadFile({size:20,url:"{:url('Upload/uploadLocality')}"});
    wk.uploadFile({size:20,num:1,url:"{:url('Upload/uploadLocality')}"});
</script>
</body>
</html>